//    Copyright (C) Kherty.  All rights reserved.
using System.ComponentModel;
using OpenLS.Core.Notification;
using OpenLS.Core.Serialization;

namespace OpenLS.Spreadsheet
{
    public class PageSetupProperties : ViewModelBase, IOfficeXmlSerializable
    {
        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (ReadContext c = context.Read("pageSetUpPr"))
            {
                _autoPageBreaks = c.GetOptionalBoolean("autoPageBreaks", true);
                _fitToPage = c.GetOptionalBoolean("fitToPage", false);
            }
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write("pageSetUpPr"))
            {
                c.SetOptionalBoolean("autoPageBreaks", _autoPageBreaks, true);
                c.SetOptionalBoolean("fitToPage", _fitToPage , false);
            }
        }

        #endregion

        private bool _autoPageBreaks = true;

        public bool AutoPageBreaks
        {
            get { return _autoPageBreaks; }
            set { _autoPageBreaks = value;notifyPropertyChanged("AutoPageBreaks"); }
        }
        private bool _fitToPage;

        public bool FitToPage
        {
            get { return _fitToPage; }
            set { _fitToPage = value;
                notifyPropertyChanged("FitToPage"); }
        }
    }
}
